#ifndef H_NOEUD
#define H_NOEUD
#include <cstdlib>
#include <map>
#include <iostream>
#include "Image.hpp"
#include <QImage>
class RegionImage;
using namespace std;
class Noeud{
	private:	
		Image m_image;
		Noeud * m_pere;
		Noeud * m_fils[4];
		map<int,Noeud*> m_adjacents;
		int m_nbFils;
		int m_id;
                RegionImage * m_region;
	protected:
	public:
		Image & getImage();
		bool isFeuille();
		Noeud(Noeud * pere);
		Noeud(Noeud * pere, const Image & image);
                void destructNoeud();
		void majAdjacent(Noeud* pere,  Noeud * fils);
		int getId() const;
		void maj();
		void eraseAdjacent(Noeud * n);
		map<int, Noeud*> * getAdjacents();
		void split();
		static int m_compteur;
		void afficheMaillage(IplImage *img);
		void merge();
		void addAdjacent(Noeud * adj);
                RegionImage * getRegion();
                void setRegion(RegionImage * region);
		void afficheRegion(IplImage* im, double color);
                void fillImage(QImage & im,QRgb value);
		
};
#endif
